dispatch
Dispatches the given event at the current event target. The event can be created using one of the DOMDocument.create*Event() methods.
For example, to perform a single mouse click event by a primary mouse button on an
eventTarget you can use the following code:
Point location = Point.of(100, 200);
MouseEventParams eventParams = MouseEventParams.newBuilder()
.button(Button.MAIN)
.clientLocation(location)
.screenLocation(location)
.uiEventModifierParams(UiEventModifierParams.newBuilder()
.eventParams(EventParams.newBuilder()
.bubbles(true)
.cancelable(true)
.build())
.build())
.build();
MouseEvent mouseEvent = document.createMouseEvent(
EventType.CLICK, eventParams);
eventTarget.dispatch(mouseEvent);
Content copied to clipboard
Return
false if the event is cancelable and at least one of the event listeners which handled this event called the preventDefault method. Otherwise returns true.
Parameters
event
the event to dispatch
Throws
when the document this instance belongs to is closed